{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from selenium import webdriver\n",
    "from selenium.webdriver.chrome.service import Service\n",
    "\n",
    "chrome_options = webdriver.ChromeOptions()\n",
    "chrome_options.add_argument(\"--headless\")\n",
    "chrome_options.add_argument(\"--no-sandbox\")\n",
    "chrome_options.add_argument(\"--disable-dev-shm-usage\")\n",
    "chrome_options.add_argument(\"--disable-gpu\")\n",
    "\n",
    "browser = webdriver.Chrome(\n",
    "    options=chrome_options,\n",
    "    service=Service('/home/hadoop/tdd2025/chromedriver-linux64/chromedriver')\n",
    ")\n",
    "\n",
    "browser.get('http://localhost:8000')\n",
    "# 应用有一个输入待办事项的文本输入框\n",
    "\n",
    "# 他在文本输入框中输入了“Buy flowers\"\n",
    "# 改他按了回车键键后，页面更新了,待办事项表格中显示了\"1:Buyflowers'\n",
    "\n",
    "# 页面中又显示了一个文本输入框，可以输入其他待办事项\n",
    "# 他输入了'Send agift to Lisi'\n",
    "# 页面再次更新，她的清单中显示了这两个待办事项\n",
    "# 张三想知道这个网站是否会记住他的清单\n",
    "# 他看到网网站为他生成了一个唯一的URI\n",
    "\n",
    "# 如果不存在，弹出提示\n",
    "assert 'To-Do' in browser.title,'Browser title was '+browser.title\n",
    "browser.quit()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "tdd",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.21"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
